package com.example.UserConsumer.RestController;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.example.UserConsumer.Entity.User;

import org.springframework.web.client.RestTemplate;  
@RestController
public class UserServerController {
	/**
	 * 此种访问的方式是直接通过RestTemple ribbon形式方法可以支持Serviceid访问
	 */
	@Autowired
	private UserFeignClient UserFeignClient;

	@GetMapping
	@RequestMapping(value = "/hello/{id}", method = RequestMethod.GET)
	public User FindUserById(@PathVariable String id)
	{
		System.out.println(id);
		User findUserById = UserFeignClient.FindUserById(id);
		System.out.println("我在使用通过FeignClient形式方法访问");
		return findUserById ;
		
	}

}
